package com.czone.myfacebook;

import java.util.StringTokenizer;

public class FaceBookPageManager {
    private String mPrevious;
    private String mNext;

    public String getPrevious() {
        if (null == mPrevious)
            return null;

        StringTokenizer st = new StringTokenizer(mPrevious, "&");
        String str;
        while (null != (str = st.nextToken())) {
            if (str.contains("since")) {
                str = str.substring(str.indexOf('=') + 1);
                break;
            }
        }
        return str;
    }

    public String getNext() {
        if (null == mNext)
            return null;

        StringTokenizer st = new StringTokenizer(mNext, "&");
        String str;
        while (null != (str = st.nextToken())) {
            if (str.contains("until")) {
                str = str.substring(str.indexOf('=') + 1);
                break;
            }
        }
        return str;
    }

    public void setPrevious(String page) {
        mPrevious = page;
    }

    public void setNext(String next) {
        mNext = next;
    }
}